/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/phone/xlaterrors.cpp,v 1.6 2003/11/21 16:12:58 itsme Exp $
 *
 *
 *  this module translates various error codes from the machine
 *  to readable format
 *
 */

#include <stdio.h>

// these are only included for the error codes
#include "codecmux.h"
#include "command.h"
#include "hayes.h"
#include "libcodec.h"
#include "phone.h"
#include "winaudio.h"
#include "winsio.h"
#include "wintapi.h"
#include "wintop.h"

#include "spif.h"
#include "spipc.h"

char *SPIPCResult(int rc)
{
    static char sbuf[20];
    switch(rc)
    {
case E_SPIPC_OK: return "E_SPIPC_OK";
case E_SPIPC_UNKNOWN: return "E_SPIPC_UNKNOWN";
case E_SPIPC_NULLPTR: return "E_SPIPC_NULLPTR";
case E_SPIPC_BADQUEUE: return "E_SPIPC_BADQUEUE";
case E_SPIPC_BADNOTIFY: return "E_SPIPC_BADNOTIFY";
case E_SPIPC_STRUCT2SMALL: return "E_SPIPC_STRUCT2SMALL";
case E_SPIPC_STRUCT2BIG: return "E_SPIPC_STRUCT2BIG";
case E_SPIPC_EMPTY: return "E_SPIPC_EMPTY";
case E_SPIPC_FULL: return "E_SPIPC_FULL";
case E_SPIPC_ATOMICWAIT: return "E_SPIPC_ATOMICWAIT";
case E_SPIPC_ATOMICTIME: return "E_SPIPC_ATOMICTIME";
case E_SPIPC_ATOMICFREE: return "E_SPIPC_ATOMICFREE";
case E_SPIPC_EVENTWAIT: return "E_SPIPC_EVENTWAIT";
case E_SPIPC_EVENTCLR: return "E_SPIPC_EVENTCLR";
case E_SPIPC_EVENTSET: return "E_SPIPC_EVENTSET";
case E_SPIPC_BADBUFFER: return "E_SPIPC_BADBUFFER";
case E_SPIPC_CMD_BADOPCODE: return "E_SPIPC_CMD_BADOPCODE";
case E_SPIPC_CMD_BADLENGTH: return "E_SPIPC_CMD_BADLENGTH";
case E_SPIPC_CMD_BADVALUE: return "E_SPIPC_CMD_BADVALUE";
case E_SPIPC_CMD_FAILED: return "E_SPIPC_CMD_FAILED";

case E_CODECMUX_CODEC: return "E_CODECMUX_CODEC";
case E_CODECMUX_REVISION: return "E_CODECMUX_REVISION";

case E_CMD_NULLPTR: return "E_CMD_NULLPTR";
case E_CMD_IPCDLL: return "E_CMD_IPCDLL";
case E_CMD_NOMEM: return "E_CMD_NOMEM";
case E_CMD_MEMFREE: return "E_CMD_MEMFREE";
case E_CMD_WAITEVT: return "E_CMD_WAITEVT";
case E_CMD_MSGQUEUE: return "E_CMD_MSGQUEUE";

case E_HAYES_NULLPTR: return "E_HAYES_NULLPTR";
case E_HAYES_CFG_MDMTYPE: return "E_HAYES_CFG_MDMTYPE";
case E_HAYES_PAR_LINKSERV: return "E_HAYES_PAR_LINKSERV";
case E_HAYES_PAR_LINKCARR: return "E_HAYES_PAR_LINKCARR";
case E_HAYES_PAR_LINKPROT: return "E_HAYES_PAR_LINKPROT";
case E_HAYES_PUT_NOECHO: return "E_HAYES_PUT_NOECHO";
case E_HAYES_PUT_ERRECHO: return "E_HAYES_PUT_ERRECHO";
case E_HAYES_PUT_BADECHO: return "E_HAYES_PUT_BADECHO";
case E_HAYES_GET_NOREPLY: return "E_HAYES_GET_NOREPLY";
case E_HAYES_GET_NOCHAR: return "E_HAYES_GET_NOCHAR";
case E_HAYES_GET_ERRDATA: return "E_HAYES_GET_ERRDATA";
case E_HAYES_EVT_RINGING: return "E_HAYES_EVT_RINGING";
case E_HAYES_MDM_OK: return "E_HAYES_MDM_OK";
case E_HAYES_MDM_RESPONSE: return "E_HAYES_MDM_RESPONSE";
case E_HAYES_MDM_ERROR: return "E_HAYES_MDM_ERROR";
case E_HAYES_MDM_CMEERR: return "E_HAYES_MDM_CMEERR";
case E_HAYES_MDM_CMSERR: return "E_HAYES_MDM_CMSERR";
case E_HAYES_MDM_CONNECT: return "E_HAYES_MDM_CONNECT";
case E_HAYES_MDM_CARRIER: return "E_HAYES_MDM_CARRIER";
case E_HAYES_MDM_DIALTONE: return "E_HAYES_MDM_DIALTONE";
case E_HAYES_MDM_BUSY: return "E_HAYES_MDM_BUSY";
case E_HAYES_MDM_ANSWER: return "E_HAYES_MDM_ANSWER";
case E_HAYES_MDM_VOICE: return "E_HAYES_MDM_VOICE";
case E_HAYES_MDM_DELAYED: return "E_HAYES_MDM_DELAYED";
case E_HAYES_MDM_BLACKLIST: return "E_HAYES_MDM_BLACKLIST";

case E_LIBCODEC_NULLPTR: return "E_LIBCODEC_NULLPTR";
case E_LIBCODEC_CODEC: return "E_LIBCODEC_CODEC";
case E_LIBCODEC_INUSE: return "E_LIBCODEC_INUSE";

case E_PHONE_NULLPTR: return "E_PHONE_NULLPTR";
case E_PHONE_NOMEM: return "E_PHONE_NOMEM";
case E_PHONE_BADPHONE: return "E_PHONE_BADPHONE";
case E_PHONE_ISOFF: return "E_PHONE_ISOFF";
case E_PHONE_NOCALL: return "E_PHONE_NOCALL";
case E_PHONE_INUSE: return "E_PHONE_INUSE";
case E_PHONE_MODE: return "E_PHONE_MODE";
case E_PHONE_INDEX: return "E_PHONE_INDEX";
case E_PHONE_CODEC: return "E_PHONE_CODEC";
case E_PHONE_SIZE: return "E_PHONE_SIZE";
case E_PHONE_FULL: return "E_PHONE_FULL";
case E_PHONE_TELTHREAD: return "E_PHONE_TELTHREAD";
case E_PHONE_TXEVENT: return "E_PHONE_TXEVENT";
case E_PHONE_RXTHREAD: return "E_PHONE_RXTHREAD";
case E_PHONE_TXTHREAD: return "E_PHONE_TXTHREAD";

case E_AUDIO_NULLPTR: return "E_AUDIO_NULLPTR";
case E_AUDIO_PAR_BUFLEN: return "E_AUDIO_PAR_BUFLEN";
case E_AUDIO_PAR_TRIGGER: return "E_AUDIO_PAR_TRIGGER";
case E_AUDIO_PAR_RATE: return "E_AUDIO_PAR_RATE";
case E_AUDIO_PAR_WINCHUNK: return "E_AUDIO_PAR_WINCHUNK";
case E_AUDIO_NOMEM: return "E_AUDIO_NOMEM";
case E_AUDIO_THREAD: return "E_AUDIO_THREAD";
case E_AUDIO_PRIO: return "E_AUDIO_PRIO";
case E_AUDIO_CLOSE: return "E_AUDIO_CLOSE";
case E_AUDIO_FREE: return "E_AUDIO_FREE";
case E_AUDIO_INTERNAL: return "E_AUDIO_INTERNAL";
case E_AUDIO_MM_UNKNOWN: return "E_AUDIO_MM_UNKNOWN";
case E_AUDIO_MM_INTERNAL: return "E_AUDIO_MM_INTERNAL";
case E_AUDIO_MM_NOMEM: return "E_AUDIO_MM_NOMEM";
case E_AUDIO_MM_INUSE: return "E_AUDIO_MM_INUSE";
case E_AUDIO_MM_FORMAT: return "E_AUDIO_MM_FORMAT";
case E_AUDIO_MM_NOSOFT: return "E_AUDIO_MM_NOSOFT";

case E_SIO_NULLPTR: return "E_SIO_NULLPTR";
case E_SIO_OPEN_PORTNUM: return "E_SIO_OPEN_PORTNUM";
case E_SIO_OPEN_CREATE: return "E_SIO_OPEN_CREATE";
case E_SIO_OPEN_GETPROP: return "E_SIO_OPEN_GETPROP";
case E_SIO_OPEN_DEVTYPE: return "E_SIO_OPEN_DEVTYPE";
case E_SIO_OPEN_NO8N1: return "E_SIO_OPEN_NO8N1";
case E_SIO_OPEN_BAUDRATE: return "E_SIO_OPEN_BAUDRATE";
case E_SIO_OPEN_FLOWCTRL: return "E_SIO_OPEN_FLOWCTRL";
case E_SIO_OPEN_USEDTR: return "E_SIO_OPEN_USEDTR";
case E_SIO_OPEN_USEDSR: return "E_SIO_OPEN_USEDSR";
case E_SIO_OPEN_USEDCD: return "E_SIO_OPEN_USEDCD";
case E_SIO_OPEN_SETBUFFER: return "E_SIO_OPEN_SETBUFFER";
case E_SIO_OPEN_SETMODE: return "E_SIO_OPEN_SETMODE";
case E_SIO_OPEN_SETTIMER: return "E_SIO_OPEN_SETTIMER";
case E_SIO_OPEN_SETDTR: return "E_SIO_OPEN_SETDTR";
case E_SIO_OPEN_GETLINE: return "E_SIO_OPEN_GETLINE";
case E_SIO_OPEN_NODSR: return "E_SIO_OPEN_NODSR";
case E_SIO_OPEN_CLRRXERR: return "E_SIO_OPEN_CLRRXERR";
case E_SIO_OPEN_CLRRXBUF: return "E_SIO_OPEN_CLRRXBUF";
case E_SIO_CLOSE_SETDTR: return "E_SIO_CLOSE_SETDTR";
case E_SIO_CLOSE_HANDLE: return "E_SIO_CLOSE_HANDLE";
case E_SIO_RXCLR_PURGE: return "E_SIO_RXCLR_PURGE";
case E_SIO_TXCLR_PURGE: return "E_SIO_TXCLR_PURGE";
case E_SIO_STATE_GETSTATE: return "E_SIO_STATE_GETSTATE";
case E_SIO_STATE_BADFLAG: return "E_SIO_STATE_BADFLAG";
case E_SIO_LINE_GETLINE: return "E_SIO_LINE_GETLINE";
case E_SIO_LINE_SIGTERM: return "E_SIO_LINE_SIGTERM";
case E_SIO_LINE_NODSR: return "E_SIO_LINE_NODSR";
case E_SIO_LINE_NODCD: return "E_SIO_LINE_NODCD";
case E_SIO_LINE_RINGING: return "E_SIO_LINE_RINGING";

case E_TAPI_NULLPTR: return "E_TAPI_NULLPTR";
case E_TAPI_NOMEM: return "E_TAPI_NOMEM";
case E_TAPI_DLLINIT: return "E_TAPI_DLLINIT";
case E_TAPI_DLLVER: return "E_TAPI_DLLVER";
case E_TAPI_TSPINIT: return "E_TAPI_TSPINIT";
case E_TAPI_TSPVER: return "E_TAPI_TSPVER";
case E_TAPI_LINENUM: return "E_TAPI_LINENUM";
case E_TAPI_LINECAPS: return "E_TAPI_LINECAPS";
case E_TAPI_LINESTAT: return "E_TAPI_LINESTAT";
case E_TAPI_ADRNUM: return "E_TAPI_ADRNUM";
case E_TAPI_ADRCAPS: return "E_TAPI_ADRCAPS";
case E_TAPI_ADRSTAT: return "E_TAPI_ADRSTAT";
case E_TAPI_LINEOPEN: return "E_TAPI_LINEOPEN";
case E_TAPI_MSGMASK: return "E_TAPI_MSGMASK";
case E_TAPI_LINECLOSE: return "E_TAPI_LINECLOSE";
case E_TAPI_LINESHUTDOWN: return "E_TAPI_LINESHUTDOWN";
case E_TAPI_GETMSG: return "E_TAPI_GETMSG";
case E_TAPI_CALLINFO: return "E_TAPI_CALLINFO";
case E_TAPI_CALLSTAT: return "E_TAPI_CALLSTAT";
case E_TAPI_ACCEPT1: return "E_TAPI_ACCEPT1";
case E_TAPI_ACCEPT2: return "E_TAPI_ACCEPT2";
case E_TAPI_NORING: return "E_TAPI_NORING";
case E_TAPI_ANSWER1: return "E_TAPI_ANSWER1";
case E_TAPI_ANSWER2: return "E_TAPI_ANSWER2";
case E_TAPI_LINKSERV: return "E_TAPI_LINKSERV";
case E_TAPI_LINKCARR: return "E_TAPI_LINKCARR";
case E_TAPI_MAKECALL1: return "E_TAPI_MAKECALL1";
case E_TAPI_MAKECALL2: return "E_TAPI_MAKECALL2";
case E_TAPI_GETPORT: return "E_TAPI_GETPORT";
case E_TAPI_CALLCLOSE: return "E_TAPI_CALLCLOSE";
case E_TAPI_CALLDROP: return "E_TAPI_CALLDROP";
case E_TAPI_CALLDEALLOC: return "E_TAPI_CALLDEALLOC";
case E_TAPI_BREAK: return "E_TAPI_BREAK";
case E_TAPI_CALL_TIMEOUT: return "E_TAPI_CALL_TIMEOUT";
case E_TAPI_CALL_UNKNOWN: return "E_TAPI_CALL_UNKNOWN";
case E_TAPI_CALL_HANGUP: return "E_TAPI_CALL_HANGUP";
case E_TAPI_CALL_PICKUP: return "E_TAPI_CALL_PICKUP";
case E_TAPI_CALL_FORWARDED: return "E_TAPI_CALL_FORWARDED";
case E_TAPI_CALL_DIALTONE: return "E_TAPI_CALL_DIALTONE";
case E_TAPI_CALL_OUTOFORDER: return "E_TAPI_CALL_OUTOFORDER";
case E_TAPI_CALL_TEMPFAILURE: return "E_TAPI_CALL_TEMPFAILURE";
case E_TAPI_CALL_CONGESTION: return "E_TAPI_CALL_CONGESTION";
case E_TAPI_CALL_BADADDRESS: return "E_TAPI_CALL_BADADDRESS";
case E_TAPI_CALL_NUMCHANGED: return "E_TAPI_CALL_NUMCHANGED";
case E_TAPI_CALL_UNREACHABLE: return "E_TAPI_CALL_UNREACHABLE";
case E_TAPI_CALL_INCOMPATIBLE: return "E_TAPI_CALL_INCOMPATIBLE";
case E_TAPI_CALL_NOANSWER: return "E_TAPI_CALL_NOANSWER";
case E_TAPI_CALL_BUSY: return "E_TAPI_CALL_BUSY";
case E_TAPI_CALL_BLOCKED: return "E_TAPI_CALL_BLOCKED";
case E_TAPI_CALL_REJECT: return "E_TAPI_CALL_REJECT";
case E_TAPI_CALL_DISTURB: return "E_TAPI_CALL_DISTURB";

    default:
        sprintf(sbuf, "ERROR %08x", rc);
        return sbuf;
    }
}

char *SPIPCCommandString(int nCmd)
{
    static char sbuf[20];
    switch(nCmd)
    {
case SPIPC_CMD_VERSION: return "SPIPC_CMD_VERSION";
case SPIPC_CMD_PING: return "SPIPC_CMD_PING";
case SPIPC_CMD_EXIT: return "SPIPC_CMD_EXIT";
case SPIPC_CMD_OFF: return "SPIPC_CMD_OFF";
case SPIPC_CMD_ON: return "SPIPC_CMD_ON";
case SPIPC_CMD_HWINFO: return "SPIPC_CMD_HWINFO";
case SPIPC_CMD_AUTOCFG: return "SPIPC_CMD_AUTOCFG";
case SPIPC_CMD_SETCFG: return "SPIPC_CMD_SETCFG";
case SPIPC_CMD_GETCFG: return "SPIPC_CMD_GETCFG";
case SPIPC_CMD_SETOUTVOL: return "SPIPC_CMD_SETOUTVOL";
case SPIPC_CMD_GETOUTVOL: return "SPIPC_CMD_GETOUTVOL";
case SPIPC_CMD_SETINVOL: return "SPIPC_CMD_SETINVOL";
case SPIPC_CMD_GETINVOL: return "SPIPC_CMD_GETINVOL";
case SPIPC_CMD_SETINMUX: return "SPIPC_CMD_SETINMUX";
case SPIPC_CMD_GETINMUX: return "SPIPC_CMD_GETINMUX";
case SPIPC_CMD_DTMFOFF: return "SPIPC_CMD_DTMFOFF";
case SPIPC_CMD_DTMFON: return "SPIPC_CMD_DTMFON";
case SPIPC_CMD_DTMFDIAL: return "SPIPC_CMD_DTMFDIAL";
case SPIPC_CMD_SETDECSTATE: return "SPIPC_CMD_SETDECSTATE";
case SPIPC_CMD_GETDECSTATE: return "SPIPC_CMD_GETDECSTATE";
case SPIPC_CMD_SETDECMODE: return "SPIPC_CMD_SETDECMODE";
case SPIPC_CMD_GETDECMODE: return "SPIPC_CMD_GETDECMODE";
case SPIPC_CMD_SETDECCODECTBL: return "SPIPC_CMD_SETDECCODECTBL";
case SPIPC_CMD_GETDECCODECTBL: return "SPIPC_CMD_GETDECCODECTBL";
case SPIPC_CMD_GETDECCODEC: return "SPIPC_CMD_GETDECCODEC";
case SPIPC_CMD_GETDECSYNC: return "SPIPC_CMD_GETDECSYNC";
case SPIPC_CMD_SETENCSTATE: return "SPIPC_CMD_SETENCSTATE";
case SPIPC_CMD_GETENCSTATE: return "SPIPC_CMD_GETENCSTATE";
case SPIPC_CMD_SETENCMODE: return "SPIPC_CMD_SETENCMODE";
case SPIPC_CMD_GETENCMODE: return "SPIPC_CMD_GETENCMODE";
case SPIPC_CMD_SETENCCODECTBL: return "SPIPC_CMD_SETENCCODECTBL";
case SPIPC_CMD_GETENCCODECTBL: return "SPIPC_CMD_GETENCCODECTBL";
case SPIPC_CMD_SETENCCODEC: return "SPIPC_CMD_SETENCCODEC";
case SPIPC_CMD_GETENCCODEC: return "SPIPC_CMD_GETENCCODEC";
case SPIPC_CMD_TXUSERDATA: return "SPIPC_CMD_TXUSERDATA";
case SPIPC_CMD_GETRANDOM: return "SPIPC_CMD_GETRANDOM";
case SPIPC_CMD_HANGUP: return "SPIPC_CMD_HANGUP";
case SPIPC_CMD_ANSWER: return "SPIPC_CMD_ANSWER";
case SPIPC_CMD_DIAL: return "SPIPC_CMD_DIAL";
case SPIPC_RES_VERSION: return "SPIPC_RES_VERSION";
case SPIPC_RES_PONG: return "SPIPC_RES_PONG";
case SPIPC_RES_EXIT: return "SPIPC_RES_EXIT";
case SPIPC_RES_OK: return "SPIPC_RES_OK";
case SPIPC_RES_ERROR: return "SPIPC_RES_ERROR";
case SPIPC_RES_HWINFO: return "SPIPC_RES_HWINFO";
case SPIPC_RES_GETCFG: return "SPIPC_RES_GETCFG";
case SPIPC_RES_GETOUTVOL: return "SPIPC_RES_GETOUTVOL";
case SPIPC_RES_GETINVOL: return "SPIPC_RES_GETINVOL";
case SPIPC_RES_GETINMUX: return "SPIPC_RES_GETINMUX";
case SPIPC_RES_GETDECSTATE: return "SPIPC_RES_GETDECSTATE";
case SPIPC_RES_GETDECMODE: return "SPIPC_RES_GETDECMODE";
case SPIPC_RES_GETDECCODECTBL: return "SPIPC_RES_GETDECCODECTBL";
case SPIPC_RES_GETDECCODEC: return "SPIPC_RES_GETDECCODEC";
case SPIPC_RES_GETDECSYNC: return "SPIPC_RES_GETDECSYNC";
case SPIPC_RES_GETENCSTATE: return "SPIPC_RES_GETENCSTATE";
case SPIPC_RES_GETENCMODE: return "SPIPC_RES_GETENCMODE";
case SPIPC_RES_GETENCCODECTBL: return "SPIPC_RES_GETENCCODECTBL";
case SPIPC_RES_GETENCCODEC: return "SPIPC_RES_GETENCCODEC";
case SPIPC_RES_GETRANDOM: return "SPIPC_RES_GETRANDOM";
case SPIPC_RES_DISCONNECT: return "SPIPC_RES_DISCONNECT";
case SPIPC_RES_CONNECT: return "SPIPC_RES_CONNECT";
case SPIPC_PRO_NEWSTATE: return "SPIPC_PRO_NEWSTATE";
case SPIPC_PRO_HANGUPSTART: return "SPIPC_PRO_HANGUPSTART";
case SPIPC_PRO_ANSWERSTART: return "SPIPC_PRO_ANSWERSTART";
case SPIPC_PRO_DIALSTART: return "SPIPC_PRO_DIALSTART";
case SPIPC_EVT_RINGOFF: return "SPIPC_EVT_RINGOFF";
case SPIPC_EVT_RINGON: return "SPIPC_EVT_RINGON";
case SPIPC_EVT_RING: return "SPIPC_EVT_RING";
case SPIPC_EVT_CALLERID: return "SPIPC_EVT_CALLERID";
case SPIPC_EVT_HANGUP: return "SPIPC_EVT_HANGUP";
case SPIPC_MUX_RXUSERDATA: return "SPIPC_MUX_RXUSERDATA";
case SPIPC_MUX_TXUSERDATA: return "SPIPC_MUX_TXUSERDATA";
case SPIPC_PRT_RXSYNC: return "SPIPC_PRT_RXSYNC";
case SPIPC_PRT_RXCODEC: return "SPIPC_PRT_RXCODEC";
    default:
        sprintf(sbuf, "CMD %08x", nCmd);
        return sbuf;
    }
}
char *SPIPCSyncStateName(int sync)
{
    static char sbuf[16];

    switch(sync)
    {
case SPIPC_SYNC_NONE:   return "SYNC_NONE";
case SPIPC_SYNC_OUTSIDE:return "SYNC_OUTSIDE";
case SPIPC_SYNC_INSIDE: return "SYNC_INSIDE";
    default:
        sprintf(sbuf, "SYNC %04x", sync);
        return sbuf;
    }
}
char *SPIPCDisconnectReason(int rc)
{
    static char sbuf[20];
    switch(rc)
    {

case SPIPC_DISCONNECT_UNSPECIFIED: return "SPIPC_DISCONNECT_UNSPECIFIED";
case SPIPC_DISCONNECT_LOC_UNSPECIFIED: return "SPIPC_DISCONNECT_LOC_UNSPECIFIED";
case SPIPC_DISCONNECT_LOC_PARAMETER: return "SPIPC_DISCONNECT_LOC_PARAMETER";
case SPIPC_DISCONNECT_LOC_SOFTWARE: return "SPIPC_DISCONNECT_LOC_SOFTWARE";
case SPIPC_DISCONNECT_LOC_MODEMTALK: return "SPIPC_DISCONNECT_LOC_MODEMTALK";
case SPIPC_DISCONNECT_MDM_UNSPECIFIED: return "SPIPC_DISCONNECT_MDM_UNSPECIFIED";
case SPIPC_DISCONNECT_MDM_LINECURRENT: return "SPIPC_DISCONNECT_MDM_LINECURRENT";
case SPIPC_DISCONNECT_MDM_NOSIM: return "SPIPC_DISCONNECT_MDM_NOSIM";
case SPIPC_DISCONNECT_MDM_NOPIN: return "SPIPC_DISCONNECT_MDM_NOPIN";
case SPIPC_DISCONNECT_MDM_NONET: return "SPIPC_DISCONNECT_MDM_NONET";
case SPIPC_DISCONNECT_NET_UNSPECIFIED: return "SPIPC_DISCONNECT_NET_UNSPECIFIED";
case SPIPC_DISCONNECT_NET_DIALDELAY: return "SPIPC_DISCONNECT_NET_DIALDELAY";
case SPIPC_DISCONNECT_NET_BLACKLISTED: return "SPIPC_DISCONNECT_NET_BLACKLISTED";
case SPIPC_DISCONNECT_NET_NUMINVALID: return "SPIPC_DISCONNECT_NET_NUMINVALID";
case SPIPC_DISCONNECT_NET_NUMCHANGED: return "SPIPC_DISCONNECT_NET_NUMCHANGED";
case SPIPC_DISCONNECT_NET_INCOMPATIBLE: return "SPIPC_DISCONNECT_NET_INCOMPATIBLE";
case SPIPC_DISCONNECT_NET_NODIALTONE: return "SPIPC_DISCONNECT_NET_NODIALTONE";
case SPIPC_DISCONNECT_NET_OUTOFORDER: return "SPIPC_DISCONNECT_NET_OUTOFORDER";
case SPIPC_DISCONNECT_NET_TEMPFAILURE: return "SPIPC_DISCONNECT_NET_TEMPFAILURE";
case SPIPC_DISCONNECT_NET_OVERLOAD: return "SPIPC_DISCONNECT_NET_OVERLOAD";
case SPIPC_DISCONNECT_USR_UNSPECIFIED: return "SPIPC_DISCONNECT_USR_UNSPECIFIED";
case SPIPC_DISCONNECT_USR_HANGUP_LOC: return "SPIPC_DISCONNECT_USR_HANGUP_LOC";
case SPIPC_DISCONNECT_USR_HANGUP_REM: return "SPIPC_DISCONNECT_USR_HANGUP_REM";
case SPIPC_DISCONNECT_USR_PICKUP: return "SPIPC_DISCONNECT_USR_PICKUP";
case SPIPC_DISCONNECT_USR_FORWARD: return "SPIPC_DISCONNECT_USR_FORWARD";
case SPIPC_DISCONNECT_USR_VOICE: return "SPIPC_DISCONNECT_USR_VOICE";
case SPIPC_DISCONNECT_USR_NOANSWER: return "SPIPC_DISCONNECT_USR_NOANSWER";
case SPIPC_DISCONNECT_USR_UNREACHABLE: return "SPIPC_DISCONNECT_USR_UNREACHABLE";
case SPIPC_DISCONNECT_USR_BUSY: return "SPIPC_DISCONNECT_USR_BUSY";
case SPIPC_DISCONNECT_USR_REJECT: return "SPIPC_DISCONNECT_USR_REJECT";
case SPIPC_DISCONNECT_USR_DISTURB: return "SPIPC_DISCONNECT_USR_DISTURB";

    default:
        sprintf(sbuf, "REASON_%02x", rc);
        return sbuf;
    }
}

